package com.zy.studentSide.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.studentSide.entity.StudentCourse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 29787
 */
@Mapper
@Component
public interface StudentCourseDao extends BaseMapper<StudentCourse> {

    /**
     * 根据学生id查询
     * @param studentId
     * @return List<StudentCourse>
     */
    @Select("select * from hms_student_course where student_id=#{studentId}")
    List<StudentCourse> getAllStudentCourse(Integer studentId);

    /**
     * 根据学生id,教师id，班级id，课程id查询已选课程信息
     * @param studentId
     * @param courseId
     * @param teacherId
     * @param classroomId
     * @return StudentCourse
     */
    @Select("select * from hms_student_course where student_id=#{studentId} and course_id=#{courseId} and teacher_id=#{teacherId} and classroom_id=#{classroomId}")
    StudentCourse getStudentCourse(Integer studentId,Integer courseId,Integer teacherId, Integer classroomId);

    /**
     * 根据班级id，课程id，教师id查询
     * @param courseId
     * @param teacherId
     * @param classroomId
     * @return List<StudentCourse>
     */
    @Select("select * from hms_student_course where course_id=#{courseId} and teacher_id=#{teacherId} and classroom_id=#{classroomId}")
    List<StudentCourse> getStudentCourseByCourseIdAndTeacherIdAndClassroomId(Integer courseId,Integer teacherId, Integer classroomId);

}
